//
//  CirclrMineInforViewModel.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/2.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "CirclrMineInforViewModel.h"
#import "CircleMineInforTVCell.h"
#import "CircleTextTableViewCell.h"
#import "PopupView.h"
#import "ZZPhotoController.h"
#import "NoDataFootTableViewHeaderFooterView.h"

// 头像调取类

@interface CirclrMineInforViewModel ()<UITableViewDelegate, UITableViewDataSource>
{
    UITableView *selfTableView;
//    NSArray *dataArr;
    UIViewController *vcs;
}

@end

@implementation CirclrMineInforViewModel

- (instancetype)initWithViewToViewModel:(UITableView *)tableView theSuperView:(UIView *)superView{
    if (self = [super initWithViewToViewModel:tableView theSuperView:superView]) {
        
        selfTableView = tableView;
        selfTableView.delegate = self;
        selfTableView.dataSource = self;
        selfTableView.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
//        selfTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
        
        selfTableView.mj_footer.hidden = YES;
        selfTableView.mj_header.hidden = YES;
        selfTableView.sectionFooterHeight = 0.0;
        selfTableView.sectionHeaderHeight = 0.0;

        [superView addSubview:selfTableView];
        [selfTableView registerClass:[NoDataFootTableViewHeaderFooterView class] forHeaderFooterViewReuseIdentifier:@"NoDataFootTableViewHeaderFooterView"];
        
//        if ([selfTableView respondsToSelector:@selector(setSeparatorInset:)]) {
//            [selfTableView setSeparatorInset:UIEdgeInsetsMake(0, 15, 0, 15)];
//        }
//        dataArr = @[@[@"我的帖子", @"我喜欢的", @"我的回帖"],@[@"回复我的", @"我的评论"]];
    }
    return self;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return kHeightProportion_In_iPhoneTriploid(10);
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.01;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    NoDataFootTableViewHeaderFooterView *footer = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"NoDataFootTableViewHeaderFooterView"];
    return footer;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
        return 74;
    }
    return 44;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell;
    if (indexPath.row == 0) {
        CircleMineInforTVCell *celll = [CircleMineInforTVCell cellWithTableView:tableView];
        cell = celll;
        return cell;
    } else if (indexPath.row == 1) {
        CircleTextTableViewCell *cell2 = [CircleTextTableViewCell cellWithTableView:tableView];
        cell2.leftStr = @"真实姓名";
        cell = cell2;
    } else {
        CircleTextTableViewCell *cell2 = [CircleTextTableViewCell cellWithTableView:tableView];
        cell2.leftStr = @"手机号";
        cell = cell2;
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
       PopupView *popView = [[PopupView alloc] initPopupview:@[@"拍照",@"从相册中选择"]];
        kWeakSelf(self);
        popView.Block_SelectType = ^(NSInteger row) {
            [weakself seletRow:row];
        };
    }
}

- (void)seletRow:(NSInteger)row
{
    if (row == 1) { // 相册
        
    } else { // 相机
    }
}

- (void)setself:(UIViewController *)vc
{
    vcs = vc;
}

@end
